翻訳と辞書
Words near each other
・ Elwing
・ Elwira Seroczyńska
・ Elwis
・ Elwomple, South Australia
・ Elwood
・ Elwood (American musician)
・ Elwood (dog)
・ Elwood (Finnish musician)
・ Elwood (horse)
・ Elwood (sternwheeler)
・ Elwood Adams Store
・ Elvis Ngolle Ngolle
・ Elvis Now
・ Elvis on Tour
・ Elvis Onyema
Elvis operator
・ Elvis Patterson
・ Elvis Peacock
・ Elvis Perkins
・ Elvis Perkins in Dearland
・ Elvis Peña
・ Elvis Phương
・ Elvis Pinel
・ Elvis Plori
・ Elvis Pompilio
・ Elvis Prençi
・ Elvis Presley
・ Elvis Presley (album)
・ Elvis Presley (disambiguation)
・ Elvis Presley albums discography


Dictionary Lists
翻訳と辞書 辞書検索 [ 開発暫定版 ]
スポンサード リンク

Elvis operator : ウィキペディア英語版
Elvis operator

In computer programming, the binary operator ?: colloquially referred to as the Elvis operator due to its resemblance to an emoticon, is a shorthand binary variant of the ternary conditional operator in languages such as PHP〔https://github.com/getrailo/railo/wiki/Operators#elvis-operator〕 and Groovy. It is used by several other languages that use the ? : operator, which is the most common ternary operator.〔(【引用サイトリンク】title=What is the PHP ? : operator called and what does it do? )
Binary ?:, used as an operator with two arguments around it and no characters in between, is used to obtain a value that is specified in the second argument if the first argument is false, and to return the value of the first argument otherwise.
An Elvis operation can be understood to represent a ?: ternary operation with the second argument omitted and assumed to equal the first.
For example,
var = foo ?: bar

contains the expression
foo ?: bar

which evaluates to foo if foo exists and has a non-null value, then var = foo; otherwise var = bar.
==Syntax==

(詳細はnull coalescing operator, this is a compression of the ternary conditional statement:

var = foo ? foo : bar

Or, expanded into an if-then statement:

if (foo != null) var = foo;
else var = bar;

It is useful for writing short conditional statements that depend on the value of a variable without changing the unspecified value (if it exists), and to avoid returning an error if the value of the condition is not set.

抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)
ウィキペディアで「Elvis operator」の詳細全文を読む



スポンサード リンク
翻訳と辞書 : 翻訳のためのインターネットリソース

Copyright(C) kotoba.ne.jp 1997-2016. All Rights Reserved.